# -*- coding: utf-8 -*-
# __author__:heliujiang
# 2022/4/3 10:30

import requests
import config
from common.test_log import create_logger

class FindVin:
    _instance = None
    logger = create_logger()
    def __new__(cls, *args, **kwargs):
        if cls._instance is None:
            cls._instance = super().__new__(cls)
        return cls._instance


    def find_vin(self,token,vin,host):
        if host == 'dev':
            self.host = config.DEV_URL
        elif host == 'uat':
            self.host = config.UAT_URL
        elif host == 'pro':
            self.host = config.PRO_URL
        url = self.host + '/appstore/goods/carInfo/findByVin'
        res = requests.get(url=url,headers={"token": token},params={'vin':vin})
        self.logger.info(f"Response status code: {res.status_code} | Response text{res.text}")
        return res

